
from tppt.lib.actions.url import get_action_url

from tppt.data.models import *

def menu_model_index(model, caption=None):
	if not caption:
		caption=model._meta.verbose_name_plural.capitalize()
	return (caption, get_action_url('index', model=model))
def menu_details(title, model, key):
	url=get_action_url('details', model=model, key=key)
	return (title, url)
def menu_action(title, action):
	url=get_action_url(action, None)
	return (title, url)

def context_processor(request):
	menu=[
		('Tools',[
				('Analyses', '/data/ppa/list'),
				('Importer', '/importer/upload'),
				('Admin', '/admin/'),
		]),
		('Data',[
				menu_model_index(Division),
				menu_model_index(AxiomFamily),
				menu_model_index(AxiomSet),
				menu_model_index(Problem),
				menu_model_index(ProblemGroup),
				menu_model_index(Result),
				menu_model_index(Proof),
				menu_model_index(ProverProblemAnalysis, caption='Analyses'),
				menu_model_index(ResultDetail),
		]),
		('Enumerations',[
				menu_model_index(TPTPVersion),
				menu_model_index(ProverClass),
				menu_model_index(ProverVersion),
				menu_model_index(ProverInstance),
				menu_model_index(ProblemStatus),
				menu_model_index(ResultType),
				menu_model_index(ResultEvaluation),
				menu_model_index(DataType),
				menu_model_index(ResultDetailType),
				menu_model_index(OutputFormat),
				menu_model_index(CPUFamily),
				menu_model_index(OS),
				menu_model_index(Computer),
				
		]),
		]
	
	[
		('Home', '/'),
		]
	res={'menu_spec': menu}
	return res